import { createRouter, createWebHistory, type RouteRecordRaw } from 'vue-router';
import Layout from '@/layout/default/index.vue';
import HomeView from '../views/HomeView.vue';

export const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: '/home',
    component: Layout,
    children: [
      {
        path: 'home',
        name: 'home',
        component: HomeView,
        meta: {
          icon: 'material-symbols:alarm-pause-rounded',
          title: '首页',
        },
      },
      {
        path: 'about',
        name: 'about',
        component: () => import('../views/AboutView.vue'),
        meta: {
          icon: 'material-symbols:alarm-pause-rounded',
          title: '关于',
        },
      },
      {
        path: 'page',
        name: 'page',
        meta: {
          icon: 'material-symbols:airport-shuttle',
          title: '测试1',
        },
        children: [
          {
            path: 'page1',
            name: 'page1',
            component: () => import('../views/AboutView1.vue'),
            meta: {
              icon: 'material-symbols:alarm-pause-rounded',
              title: '测试2',
              parent: 'page',
            },
          },
          {
            path: 'page2',
            name: 'page2',
            component: () => import('../views/AboutView2.vue'),
            meta: {
              icon: 'material-symbols:alarm-pause-rounded',
              title: '测试3',
              parent: 'page',
            },
          },
        ],
      },
    ],
  },
];
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes,
});

export default router;
